package info;

import java.util.HashMap;
import java.util.Map;
import tool.*;
public class User {
    private long id = -1;
    private String number = new String();
    private String name = new String();
    private  String pwd = new String();
    private String role = null;

    private String[] Roles={"Stu","Teacher","Counsellor"};

    public String[] Code = {"123"};

    public long getId(){
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getNumber(){
        return this.number;
    }
    public void setNumber(String number){

        this.number=number;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getPwd() {
        return pwd;
    }
    public void setPwd(String pwd) {
        Encryption decrypt = new Encryption();
        this.pwd = decrypt.Encode(pwd);
    }
    public boolean verifyPwd(String pwd) {
        return this.pwd.equals(pwd);
    }
    public void setRole(String role){
        for(String r : Roles){
            System.out.println("开始匹配:"+r);
            if(r.equals(role)){
                System.out.println("匹配成功:"+r);
                this.role=role;
                break;
            }
        }
    }
    public String getRole(){
        return this.role;
    }
    public String getCode(int i){
        return this.Code[i];
    }


}

